#ifndef __MEMORY_H__
#define __MEMORY_H__

#include "../PreDefine.h"
//#define DEBUG_MEM_LEACK

//#define DELETE delete

#ifdef DEBUG_MEM_LEACK
#pragma warning( disable : 4291 )
#define GL_NEW new(__FILE__, __LINE__)
void *operator new(size_t nSize, const char *file, int line);
void *operator new[](size_t nSize, const char *file, int line);
void DumpUnfreed();
#else
#define GL_NEW new
void* operator new(size_t nSize);
void *operator new[](size_t nSize);
#endif
void operator delete(void *p);
void operator delete[](void *p);


#ifndef NULL
#define NULL 0
#endif

#define STRDUP(str1,str2) str1 =  strdup(str2)
#define SAFE_DEL(p) SAFE_DELETE(p)
#define SAFE_DEL_ARRAY(a)			SAFE_DELETE_ARRAY(a)
#define CLEARMEM(ary,size)		{ if (size > 0) memset(ary, 0, size); }

#endif // __MEMORY_H__

